import pjavafxcookiecoding.*;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Slider;

PJavaFXCookieCoding pjx;
    int b = 0;
    
    @Override
    public void setup() {
        size(510, 510);
        smooth();
        noStroke();
        pjx = new PJavaFXCookieCoding(this);
        pjx.drawTwoWindows();
    }

    @Override
    public void draw() {
        background(200);
        fill(b);
        ellipse(100,100,width/2, height/2);
    }
public void makeGUI(PJavaFXCookieCoding pjx){
        Group root = new Group();
        pjx.setScene(new Scene(root, 510, 510));
        
        final Slider slider = new Slider();
        slider.setMin(0);
        slider.setMax(250);
        slider.setValue(40);     
        slider.setShowTickLabels(true);
        slider.setShowTickMarks(true);
        slider.setMinWidth(400);
        slider.setLayoutX(50);
        slider.setLayoutY(20);
        slider.valueProperty().addListener(new ChangeListener<Number>() {
            public void changed(ObservableValue<? extends Number> ov,
                Number old_val, Number new_val) {
                    b = (int)(slider.getValue());
            }
        });

        root.getChildren().add(slider);
    }
